home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / TIPS / PRINTBMP.PAS < prev    next >
Pascal/Delphi Source File  |  1991-10-09  |  2KB  |  66 lines

  1. {************************************************}
  2. {                                                }
  3. {   Turbo Pascal for Windows                     }
  4. {   Tips & Techniques Demo Program               }
  5. {   Copyright (c) 1991 by Borland International  }
  6. {                                                }
  7. {************************************************}
  8.  
  9.  
  10.  
  11. Program MyBitmapPrinter;
  12.  
  13. uses WObjects, WinProcs, WinTypes, hCopy;
  14.  
  15. {$R printbmp}
  16.  
  17. const
  18.   id_Print = 101;
  19.  
  20. type
  21.   TMyApplication = object(TApplication)
  22.     procedure InitMainWindow; virtual;
  23.   end;
  24.  
  25.   PMyWIndow = ^TMyWindow;
  26.   TMyWindow = object(TWindow)
  27.     constructor Init(AParent: PWindowsObject; ATitle: PChar);
  28.     procedure GetWindowClass(var AWndClass : TWndClass); virtual;
  29.     procedure PrintIT(var Msg : TMessage); virtual cm_first + id_Print;
  30.   end;
  31.  
  32. { TMyApplication }
  33. procedure TMyApplication.InitMainWindow;
  34. begin
  35.    MainWindow:= new(PMyWindow,init(nil,'Print Example'));
  36. end;
  37.  
  38. { TMyWindow }
  39. constructor TMyWindow.Init(AParent: PWindowsObject; ATitle: PChar);
  40. begin
  41.   TWindow.Init(AParent, ATitle);
  42. end;
  43.  
  44. procedure TMyWindow.GetWindowClass(var AWndClass : TWndClass);
  45. begin
  46.   TWindow.GetWindowClass(AWndClass);
  47.   AWndClass.lpszMenuName := 'MyMenu';
  48. end;
  49.  
  50. procedure TMyWindow.PrintIT(var Msg : TMessage);
  51. var
  52.   hBmp:hBitMap;
  53. begin
  54.   hBmp:= LoadBitmap(hInstance, 'MyBitMap');
  55.   if hBMP<>0 then
  56.   PrintBitmap(HWindow, hBmp);
  57. end;
  58.  
  59. { Main }
  60. var
  61.   MyApp: TMyApplication;
  62. begin
  63.   MyApp.Init('MyProgram');
  64.   MyApp.Run;
  65.   MyApp.Done;
  66. end.